-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(world): add World prototype #405
Conversation
a69b823
to
9950bab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm overall, just some nits/questions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly just questions from me!
import { PackedCounter, PackedCounterLib } from "store/PackedCounter.sol"; | ||
|
||
// -- User defined schema and tableId -- | ||
struct AddressToBytes32Schema { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for both Address
and AddressToBytes32
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address
represents mapping(bytes32 => address)
, AddressToBytes32
represents mapping(address => bytes32)
. Address
is the underlying schema for the OwnerTable
(in this case only address
can be owner of things), AddressToBytes32
is the underlying schema for the SystemRouteTable
to store the routeId of a given system. The purpose of the latter is to check whether a system is already registered in a World. Systems (= contracts) can only be registered once per World, because otherwise it would mess up the access mechanism based on addresses.
… report is up to date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@@ -9,6 +9,7 @@ | |||
"ds-test/=node_modules/ds-test/src/", | |||
"solecs/=node_modules/@latticexyz/solecs/src/", | |||
"royalty-registry/=node_modules/@manifoldxzy/royalty-registry/contracts/", | |||
"std-contracts/=node_modules/@latticexyz/std-contracts/src/" | |||
"std-contracts/=node_modules/@latticexyz/std-contracts/src/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not blocking for this PR but we should update these usages to use the @latticexyz/std-contracts
import format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
considering it's a breaking change and not relevant for v2, is it worth it for v1 packages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do breaking changes all the time 🙈
) external; | ||
|
||
// Register hooks to be called when a record or field is set or deleted | ||
function registerHook(uint256 table, IStoreHook hooks) external; | ||
function registerStoreHook(uint256 table, IStoreHook hooks) external; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably be IStoreHook hook
(singular) not IStoreHook hooks
?
*/ | ||
function getSubslice(bytes memory data, uint256 start) internal pure returns (Slice) { | ||
return getSubslice(data, start, data.length); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming nit: what about just slice
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I named it that way pretty much just to avoid confusion with the Slice
type, and make searching for it easier
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ | ||
// "skipLibCheck": true /* Skip type checking all .d.ts files. */ | ||
} | ||
// "exclude": ["dist", "**/*.spec.ts", "packages"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can prob remove all these comments to make the tsconfig easier to read
Prototype for #393